package com.we823.project.common.file;

import java.util.ArrayList;
import java.util.List;

import com.we823.project.core.web.WebConstants;
import com.we823.project.model.repo.MaterialStockOutModel;
import com.we823.utils.web.DateUtil;

public class MaterialStockOutUtil extends ExcelUtil<MaterialStockOutModel> {

	@Override
	public List<String[]> parseContent(List<MaterialStockOutModel> content) {
		if(content!=null) {
			List<String[]> contentList = new ArrayList<>();
			int index=1;
			for (MaterialStockOutModel materialStockOutModel : content) {
				String[] contentArray = new String[] {
						index+""
						,materialStockOutModel.getStationName()
						,materialStockOutModel.getUserName()
						,materialStockOutModel.getMaterialCode()
						,materialStockOutModel.getMaterialName()
						,materialStockOutModel.getModel()
						,materialStockOutModel.getNeedNum()+""
						,materialStockOutModel.getFinalNum()+""
						,materialStockOutModel.getUnit()
						,DateUtil.parse(materialStockOutModel.getEdittime(), WebConstants.DATE_PATTERN)
				};
				contentList.add(contentArray);
				index++;
			}
			return contentList;
		}
		return null;
	}

	@Override
	public String[] buildHeader() {
		return new String[] {
				"序号"
				,"工位"
				,"用户名"
				,"物料代号"
				,"物料名称"
				,"规格"
				,"申请数量"
				,"最终数量"
				,"单位"
				,"领取时间"
		};
	}

}
